package com.zhutengwei.android.zuji.db;

import android.database.Cursor;

import com.zhutengwei.android.zuji.model.UserModel;

/**
 * Created by Administrator on 2016/12/20.
 */
public class UserCursorWrapper extends android.database.CursorWrapper {
    /**
     * Creates a cursor wrapper.
     *
     * @param cursor The underlying cursor to wrap.
     */
    public UserCursorWrapper(Cursor cursor) {
        super(cursor);
    }
    public UserModel getUser(){
        String nickname = getString(getColumnIndex(UserTable.COLUMN_NICKNAME));
        String address = getString(getColumnIndex(UserTable.COLUMN_ADDRESS));
        String email = getString(getColumnIndex(UserTable.COLUMN_EMAIL));
        String phonenum = getString(getColumnIndex(UserTable.COLUMN_PHONENUM));
        String userpass = getString(getColumnIndex(UserTable.COLUMN_USERPASS));
        String avatar = getString(getColumnIndex(UserTable.COLUMN_AVATAR));
        String signature = getString(getColumnIndex(UserTable.COLUMN_SIGNATURE));
        String registerdate = getString(getColumnIndex(UserTable.COLUMN_REGISTERDATE));

        UserModel user = new UserModel(nickname);
        user.setAddress(address);
        user.setPhonenum(phonenum);
        user.setEmail(email);
        user.setUserpass(userpass);

        user.setAvatar(avatar);
        user.setSignature(signature);
        user.setRegisterdate(registerdate);

        return user;
    }

}
